import { defineConfig } from "vitepress";
import path from "path";
import { mdPlugin } from "./../plugins/markdownIt";
const resolve = (dir) => path.join(__dirname, dir);
const IS_PROD = () => {
  return process.argv[process.argv.length - 1] === "build";
};
export default defineConfig({
  outDir: resolve("../document"),
  base: IS_PROD() ? "/component-docs-template/document/" : "/",
  title: "组件文档",
  description: "组件文档",
  head: [
    ["link", { rel: "icon", type: "image/svg+xml", href: "images/logo.svg" }],
  ],
  lastUpdated: true,
  markdown: {
    theme: "material-palenight",
    lineNumbers: false,
    config: (md) => mdPlugin(md),
  },
  themeConfig: {
    lastUpdatedText: "上次更新",
    editLink: {
      pattern: "https://gitee.com/fe-hl/component-docs-template",
      text: "在GitHub上编辑此页",
    },
    logo: "images/logo.svg",
    nav: [
      { text: "主页", link: "/" },
      { text: "指南", link: "/pages/guide" },
      { text: "更新日志", link: "/pages/updateLog" },
    ],

    socialLinks: [
      {
        icon: "github",
        link: "https://gitee.com/fe-hl/component-docs-template",
      },
    ],
    sidebar: [
      {
        collapsible: true,
        items: [
          {
            text: "开发指南",
            link: "/pages/guide",
          },
        ],
      },
      {
        text: "业务组件",
        collapsible: true,
        items: [
          {
            text: "按钮",
            link: "/pages/button",
          },
        ],
      },
    ],
  },
});
